<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/style.css">
<title>八维贴吧后台管理系统</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.2.1.js">
	</script>
</head>
<body>
	<!-- 头部分 -->
	<jsp:include page="/WEB-INF/view/admin/header.jsp"></jsp:include>

	<div class="container-fluid">
		<div class="row">
			<!-- 左侧部分 -->
			<jsp:include page="/WEB-INF/view/admin/left.jsp"></jsp:include>




			<!-- ////自己开发的部分///////////// -->
			<div class="col9" style="height: 500px;">

				<h1 align="center">用户管理</h1>

				<form style="display: none;" id="pageFrm"
					action="${pageContext.request.contextPath}/admin/users"
					method="post">
					<input type="text" id="pageNum" value="${pageInfo.pageNum}"
						name="pageNum" />
				</form>


				<table>
					<thead>
						<tr>
							<th>昵称</th>
							<th>性别</th>
							<th>年龄</th>
							<th>发贴数</th>
							<th>注册时间</th>
							<th>角色</th>
							<th>操作</th>

						</tr>
					</thead>

					<tbody>
						<c:forEach var="user" items="${pageInfo.list}">
							<tr>
								<td>${user.nickName }</a></td>
								<td align="center">${user.gender.displayName}</td>
								<td align="center"><fmt:formatDate value="${user.birthday}"
										pattern="yyyy-MM-dd" /></td>
								<td align="center">${user.topicNum }</td>
								<td align="center"><fmt:formatDate value="${user.created}"
										pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td>
								 <c:choose>
								   <c:when test="${user.role=='ADMIN'}">管理员</c:when>
								   <c:otherwise>普通用户</c:otherwise>
								 </c:choose>
								</td>	
								<td>
								 启用|锁定
								</td>	
							</tr>

						</c:forEach>

					</tbody>
				</table>

				<!-- 分页代码包含部分，注意page_num.jsp中的变量名称为pageInfo -->
				<p align="center">
					<jsp:include page="/WEB-INF/view/page/page_num.jsp" />
				</p>


			</div>

			<!-- ////自己开发的部分///////////// -->
		</div>
	</div>

	<script type="text/javascript">
		function searchData(pageNum) {
			$("#pageNum").val(pageNum);
			$("#pageFrm").submit();
		}
	</script>
</body>
</html>